<?php

/**
 * @author игорь
 * @copyright 2009
 */
//$com = new CommentWizard($db);
$action_template = "item";
$obj->db->query("UPDATE $obj->table SET hits = hits + 1 WHERE id = '$item_id' LIMIT 1");
$item = $selected_item;
$item = array_merge($obj->getAdditionalInfoByItem($item),$item);
$category = $obj->cat->getItem($selected_cat_id);
$rating['obj_id'] = $item_id;
$rating['module'] = "flash";
$rating['rating'] = $item['rating'];
$rating['rating_text'] = uni_word_end("балл",($item['rating']/1),array("ов","а",""),1);
$rating['votes'] = $item['votes'];
$rating['votes_text'] = uni_word_end("оцен",intval($item['votes']),array("ок","ки","ка"),1);
$rating['hits'] = $item['hits'];
$rating['hits_text'] = uni_word_end("просмотр",intval($item['hits']),array("ов","а",""),1);
$item['hits_text'] = $rating['hits_text'];
if(!$user->user_id)
{
	$is_vote = $db->fetch_one("SELECT id FROM $table_ratings WHERE obj_id = '".$item_id."' AND module = 'flash' AND user_id = '0' AND ip = '$user->ip'");
}
else
{
	$is_vote = $db->fetch_one("SELECT id FROM $table_ratings WHERE obj_id = '".$item_id."' AND module = 'flash' AND user_id = '$user->user_id'");
}
if($is_vote != false and intval($is_vote['id']) != 0)
{
	$uservote = $db->fetch_one("SELECT * FROM $table_ratings WHERE id = '".$is_vote['id']."'");
	$rating['uservote'] = $uservote;
}
$smarty->assign("item",$item);
$smarty->assign("rating",$rating);
$smarty->assign("access_comments",true);
$comments = $obj->getComments($item_id);
$obj->com->setRandomNumbers();
$smarty->assign("comments",$comments);
$this->adress_string[] = array(
	'title' =>$category['title'],
	'menu_title' =>$category['title'],
	'alias' => SITE_URL.$this->full_alias."cat_".$category['alias']."/"
);
$this->adress_string[] = array(
	'title' =>$item['title'],
	'menu_title' =>$item['title'],
	'alias' => SITE_URL.$this->full_alias.$item['alias'].".html"
);
$header = $item['title'].". ".$categories[$category['alias']];
$smarty->assign("header",$header);
$this->info['title'] = $header.". ".$this->info['title'];
?>